/*
 *===========================================================================
 *
 *          Name: string.c
 *        Create: Fri 13 Jul 2012 05:25:25 PM CST
 *
 *   Discription: 
 *       Version: 1.0.0
 *
 *        Author: yuwei.zhang
 *         Email: yuwei.zhang@besovideo.com
 *
 *===========================================================================
 */

#include <stdio.h>
#include <string.h>

#include "jkstring.h"

int jk_remove_blank(char *source, char *dist)
{
    if (source == NULL || dist == NULL) return -1;

    int    len = strlen(source);
    int    i,j=0;
    int    indx_before = 0;
    int    indx_after = len - 1;

    do {
        if (source[indx_before] != ' ') {
            break;
        }
    } while(indx_before++ < len);
    do {
        if (source[indx_after] != ' ') {
            break;
        }
    } while(indx_after--);

    while(indx_before <= indx_after) {
        dist[j++] = source[indx_before++];
    }
    dist[j] = '\0';

    return 0;
}


/*=============== End of file: string.c ==========================*/

